import React from "react";
import axios from "axios";
import { Table } from "antd";
axios.defaults.timeout = 6000;
class SuiS extends React.Component {
  constructor() {
    super();
    this.state = {
      a: [],
      b: [],
      c: [],
      d: [],
      e: [],
      f: [],
      g: [],
      h: [],
      i: [],
      j: [],
    };
  }

  /* 
  a= 蔡正平= 43.153.65.89
  b= 郭发展=  43.153.79.98
  c = 郭蒋平= 43.135.172.133
  d  = 郭凯鸿6=43.152.217.89
  e=  郭煜尚7= 43.158.210.229
  f= 李瑶瑶2= 43.158.194.253
  g=  潘秀丽1= 43.134.231.239
  h=    彭香兰8=  43.135.155.149
  i= 叶凤华3=43.156.231.195
  j= 沈信义5=119.28.250.113
  k=刘爱绿4=119.28.250.113
  */
  componentDidMount() {
    // 账号1的高度a
    axios
      .get("http://43.153.68.26:31401")
      .then((res) => {
        console.log(res.data.core_latest_ledger);
        this.setState({
          a: res.data.core_latest_ledger,
        });
      })
      .catch((err) => {
        this.setState({ a: "0" });
      });
    //账号2高度b
    axios
      .get("http://43.135.166.80:31401")
      .then((res) => {
        console.log(res.data.core_latest_ledger);
        this.setState({
          b: res.data.core_latest_ledger,
        });
      })
      .catch((err) => {
        this.setState({ b: "0" });
      });
    //账号3高度c
    axios
      .get("http://43.153.79.135:31401")
      .then((res) => {
        console.log(res.data.core_latest_ledger);
        this.setState({
          c: res.data.core_latest_ledger,
        });
      })
      .catch((err) => {
        this.setState({ c: "0" });
      });
    //账号4高度d
    axios
      .get("http://170.106.194.145:31401")
      .then((res) => {
        console.log(res.data.core_latest_ledger);
        this.setState({
          d: res.data.core_latest_ledger,
        });
      })
      .catch((err) => {
        this.setState({ d: "0" });
      });
    //账号5高度e
    axios
      .get("http://43.153.120.159:31401")
      .then((res) => {
        console.log(res.data.core_latest_ledger);
        this.setState({
          e: res.data.core_latest_ledger,
        });
      })
      .catch((err) => {
        this.setState({ e: "0" });
      });
    //账号6高度f
    axios
      .get("http://43.153.15.235:31401")
      .then((res) => {
        console.log(res.data.core_latest_ledger);
        this.setState({
          f: res.data.core_latest_ledger,
        });
      })
      .catch((err) => {
        this.setState({ f: "0" });
      });
    //账号7高度g
    axios
      .get("http://43.135.153.93:31401")
      .then((res) => {
        console.log(res.data.core_latest_ledger);
        this.setState({
          g: res.data.core_latest_ledger,
        });
      })
      .catch((err) => {
        this.setState({ g: "0" });
      });
    // //账号8高度h
    // axios
    //   .get("http://43.135.155.149:31401")
    //   .then((res) => {
    //     console.log(res.data.core_latest_ledger);
    //     this.setState({
    //       h: res.data.core_latest_ledger,
    //     });
    //   })
    //   .catch((err) => {
    //     this.setState({ h: "0" });
    //   });
    // //账号9高度i
    // axios
    //   .get("http://43.156.231.195:31401")
    //   .then((res) => {
    //     console.log(res.data.core_latest_ledger);
    //     this.setState({
    //       i: res.data.core_latest_ledger,
    //     });
    //   })
    //   .catch((err) => {
    //     this.setState({ i: "0" });
    //   });
    // //账号10高度j
    // axios
    //   .get("http://119.28.250.113:31401")
    //   .then((res) => {
    //     console.log(res.data.core_latest_ledger);
    //     this.setState({
    //       j: res.data.core_latest_ledger,
    //     });
    //   })
    //   .catch((err) => {
    //     this.setState({ j: "0" });
    //   });
    // //账号10高度k
    // axios
    //   .get("http://119.28.250.113:31401")
    //   .then((res) => {
    //     console.log(res.data.core_latest_ledger);
    //     this.setState({
    //       k: res.data.core_latest_ledger,
    //     });
    //   })
    //   .catch((err) => {
    //     this.setState({ k: "0" });
    //   });
  }
  render() {
    const dataSource = [
      {
        key: "1",
        name: " 李淑元",
        address: this.state.a,
        differ: this.state.a - this.state.a,
        todesk:'769 663 858',
        ip: (
          <a href="http://43.153.68.26:31401" target="_blank">
            43.153.68.26
          </a>
        ),
        des: "云服务器美国",
      },
      {
        key: "2",
        name: "王永辉",
        address: this.state.b,
        differ: this.state.a - this.state.b,
        todesk:'427 086 322',
        ip: (
          <a href="http://43.135.166.80:31401" target="_blank">
           43.135.166.80
          </a>
        ),
        des: "云服务器美国",
      },
      {
        key: "3",
        name: "温州徐总-7",
        address: this.state.d,
        differ: this.state.a - this.state.d,
        todesk:'472 805 239',
        ip: (
          <a href="http://170.106.194.145:31401" target="_blank">
           170.106.194.145
          </a>
        ),
        des: "云服务器美国",
      },
      {
        key: "4",
        name: "洋洋4",
        address: this.state.c,
        differ: this.state.a - this.state.c,
        todesk:'368 060 559',
        ip: (
          <a href="http://43.153.79.135:31401" target="_blank">
           43.153.79.135
          </a>
        ),
        des: "云服务器美国",
      },
      {
        key: "5",
        name: "洋洋3",
        address: this.state.e,
        differ: this.state.a - this.state.e,
        todesk:'200 603 008',
        ip: (
          <a href="http://43.153.120.159:31401" target="_blank">
            43.153.120.159
          </a>
        ),
        des: "云服务器美国",
      },
      {
        key: "6",
        name: "张泥1",
        address: this.state.f,
        differ: this.state.a - this.state.f,
        todesk:'772 783 338',
        ip: (
          <a href="http://43.153.15.235:31401" target="_blank">
          43.153.15.235
          </a>
        ),
        des: "云服务器美国",
      },
      {
        key: "7",
        name: "张泥2",
        address: this.state.g,
        differ: this.state.a - this.state.g,
        todesk:'612 420 815',
        ip: (
          <a href="http://43.135.153.93:31401" target="_blank">
           43.135.153.93
          </a>
        ),
        des: "云服务器美国",
      },
    //   {
    //     key: "8",
    //     name: "彭香兰8",
    //     address: this.state.h,
    //     differ: this.state.a - this.state.h,
    //     todesk:'595 484 048',
    //     ip: (
    //       <a href="http://43.135.155.149:31401" target="_blank">
    //       43.135.155.149
    //       </a>
    //     ),
    //     des: "云服务器美国",
    //   },
    //   {
    //     key: "9",
    //     name: " 叶凤华3",
    //     address: this.state.i,
    //     differ: this.state.a - this.state.i,
    //     todesk:'397 577 821',
    //     ip: (
    //       <a href="http://43.156.231.195:31401" target="_blank">
    //         43.156.231.195
    //       </a>
    //     ),
    //     des: "云服务器新加坡",
    //   },
    //   {
    //     key: "10",
    //     name: " 刘爱绿4",
    //     address: this.state.j,
    //     differ: this.state.a - this.state.j,
    //     todesk:'495 024 351',
    //     ip: (
    //       <a href="http://119.28.250.113:31401" target="_blank">
    //         119.28.250.113
    //       </a>
    //     ),
    //     des: <font color='red'>云服务器孟买</font>,
    //   },
    //   {
    //     key: "11",
    //     name: "沈信义5",
    //     address: this.state.j,
    //     differ: this.state.a - this.state.j,
    //     todesk:'910 610 767',
    //     ip: (
    //       <a href="http://119.28.250.113:31401" target="_blank">
    //        119.28.250.113
    //       </a>
    //     ),
    //     des: <font color='red'>云服务器孟买</font>,
    //   },
    ];
    const columns = [
      {
        title: "业主名字",
        dataIndex: "name",
        key: "name",
      },
      {
        title: "区块高度",
        dataIndex: "address",
        key: "address",
      },
      {
        title: "区块延迟数值",
        dataIndex: "differ",
        key: "differ",
      },
      {
        title: "todesk",
        dataIndex: "todesk",
        key: "todesk",
      },
      {
        title: "云服务器ip地址",
        dataIndex: "ip",
        key: "ip",
      },
      {
        title: "云服务器地区",
        dataIndex: "des",
        key: "des",
      },
    ];
    return (
      <div>
       
        <center><font size="18" color="red">
        随升7台节点区块高度
        </font></center>
        <Table dataSource={dataSource} columns={columns} />;
      </div>
    );
  }
}

export default SuiS;
